package pers.xx.sbm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import pers.xx.sbm.service.DyReportCountyDataService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 德育区级报告
 */
@Controller
@RequestMapping("/dyReportCountyData")
public class DyReportCountyDataController {

    @Autowired
    private DyReportCountyDataService dyReportDataService;

    /**
     * 区级接口
     *
     * @return
     */
    @RequestMapping(value = "/getData", method = RequestMethod.GET)
    @ResponseBody
    public Map<String, Object> getData(String areaName, String sysCode) {
        Map result = new HashMap<>();

        int studentNumber = dyReportDataService.getNumbers(areaName,"");
        result.put("studentNumber",studentNumber);

        int primaryStudentNumber = dyReportDataService.getNumbers(areaName,"小学");
        result.put("primaryStudentNumber",primaryStudentNumber);

        int juniorStudentNumber = dyReportDataService.getNumbers(areaName,"初中");
        result.put("juniorStudentNumber",juniorStudentNumber);

        int seniorStudentNumber = dyReportDataService.getNumbers(areaName,"高中");
        result.put("seniorStudentNumber",seniorStudentNumber);

        String allSituationTxt = dyReportDataService.getAllSituationTxt(areaName,"");
        result.put("allSituationTxt",allSituationTxt);

        Map<String,Object> allSituationScore = dyReportDataService.getAllSituationScore(areaName);
        result.put("allSituationScore",allSituationScore);

        List<Map<String,Object>> sampleData = dyReportDataService.getSampleData(areaName);
        result.put("sampleData",sampleData);

        String primaryAllSituationTxt = dyReportDataService.getAllSituationTxt(areaName,"小学");
        result.put("primaryAllSituationTxt",primaryAllSituationTxt);

        List<Map<String,Object>> primaryAllSituationScore = dyReportDataService.getAllSituationScoreByAreaAndXd(areaName,"小学");
        result.put("primaryAllSituationScore",primaryAllSituationScore);

        Map<String,Object> primaryUrDiff = dyReportDataService.getDiff(areaName,"小学","`8`");
        result.put("primaryUrDiff",primaryUrDiff);

        Map<String,Object> primarySexDiff = dyReportDataService.getDiff(areaName,"小学","sex");
        result.put("primarySexDiff",primarySexDiff);

        Map<String,Object> primarySingleChildDiff = dyReportDataService.getDiff(areaName,"小学","`6`");
        result.put("primarySingleChildDiff",primarySingleChildDiff);

        Map<String,Object> primaryAchievementDiff = dyReportDataService.getDiff(areaName,"小学","`10`");
        result.put("primaryAchievementDiff",primaryAchievementDiff);

        List<Map<String,Object>> primaryIndexes = dyReportDataService.getIndexes(areaName,"小学");
        result.put("primaryIndexes",primaryIndexes);

        String juniorAllSituationTxt = dyReportDataService.getAllSituationTxt(areaName,"初中");
        result.put("juniorAllSituationTxt",juniorAllSituationTxt);

        List<Map<String,Object>> juniorAllSituationScore = dyReportDataService.getAllSituationScoreByAreaAndXd(areaName,"初中");
        result.put("juniorAllSituationScore",juniorAllSituationScore);

        Map<String,Object> juniorUrDiff = dyReportDataService.getDiff(areaName,"初中","`8`");
        result.put("juniorUrDiff",juniorUrDiff);

        Map<String,Object> juniorSexDiff = dyReportDataService.getDiff(areaName,"初中","sex");
        result.put("juniorSexDiff",juniorSexDiff);

        Map<String,Object> juniorSingleChildDiff = dyReportDataService.getDiff(areaName,"初中","`6`");
        result.put("juniorSingleChildDiff",juniorSingleChildDiff);

        Map<String,Object> juniorAchievementDiff = dyReportDataService.getDiff(areaName,"初中","`10`");
        result.put("juniorAchievementDiff",juniorAchievementDiff);

        List<Map<String,Object>> juniorIndexes = dyReportDataService.getIndexes(areaName,"初中");
        result.put("juniorIndexes",juniorIndexes);

        String seniorAllSituationTxt = dyReportDataService.getAllSituationTxt(areaName,"高中");
        result.put("seniorAllSituationTxt",seniorAllSituationTxt);

        List<Map<String,Object>> seniorAllSituationScore = dyReportDataService.getAllSituationScoreByAreaAndXd(areaName,"高中");
        result.put("seniorAllSituationScore",seniorAllSituationScore);

        Map<String,Object> seniorUrDiff = dyReportDataService.getDiff(areaName,"高中","`8`");
        result.put("seniorUrDiff",seniorUrDiff);

        Map<String,Object> seniorSexDiff = dyReportDataService.getDiff(areaName,"高中","sex");
        result.put("seniorSexDiff",seniorSexDiff);

        Map<String,Object> seniorSingleChildDiff = dyReportDataService.getDiff(areaName,"高中","`6`");
        result.put("seniorSingleChildDiff",seniorSingleChildDiff);

        Map<String,Object> seniorAchievementDiff = dyReportDataService.getDiff(areaName,"高中","`10`");
        result.put("seniorAchievementDiff",seniorAchievementDiff);

        List<Map<String,Object>> seniorIndexes = dyReportDataService.getIndexes(areaName,"高中");
        result.put("seniorIndexes",seniorIndexes);

        String txt = dyReportDataService.getIndexTxt(areaName);
        result.put("txt",txt);
        return result;
    }
}
